fixed exit problem