I think you need to change the cmd_state on line 299 as well in order for this to work.