fix exit bug