Fixed command handling for exceptions