Fixed exit bug