Bugfix: Loading state files was broken.

Fixes #3562