fixed command exception handling