fix emtpy stack error