Fix to regeneration bug