Add a check command and fix error reporting