Fix issue with multiple entries for apikeys on restart