Avoided leaking state on exceptions in populate_models().