fixed exception handling for commands