shut down application when allocated resource is not enough and minor bug fix