fixed stack bug