Fix edge case for goal generation.