Fixed potential NPE in restoreState (Issue #47)