wasn't properly clearing the stack