Fixed bug in the valid_command! method