Merge "Fixing the state restore bug."