fixed exit capture bug