fixed stack imbalance problem