Fix exit bug