Make loading from JSON more robust.