Bug fix to improve fit refinement with distortions