fix stack_pop function