fix InvalidCommandError and more clear can_read? code (thnx stevenharman)