Fixed bug with sending state change commands