Fix the pop function