Fix crash when loading invalid objects.