fixed stack advance function