Fix for a rare condition in flexible rotation potentials.

Change-Id: Icc6c7fceaba3fa53f3f2d627c3c205469fc9d710