Fix the exit bug