Fixed incomplete exit problem