fixes for vs2012 and moving terminate method to state_machine base class