Fix a bug in stack with minimum solution