Fixed infinite loop bug caused by last push