corrected incorrect pop/push order