adding error checking to commands