enhanced invalid command handling