Closes #985. Fixed a special case of j-optimisation.