Fix quit bug