Fixed bug causing incorrect state machines to sometimes be generated for switch statements (#316)