better exception handling for commands