ENH: Added option --debug-state
FIX: Fixed problem in state forking