Fixing incorrect command handling