add forbidden handling, fix exit bug