Patch for a couple of stack inconsistency bugs