Fixed the non exit problem