Fixed bug with failed wait on invalid command