Patch history callback. Safely ignores invalid user id's from database init data. It now checks if a user id is vaild before loading it.