fixed exit bug