better state saving and loading for hb and npcs