Bugfix 13761

Includes the 6.7 merge so should probably wait until after all of the 6.7 stuff is finished...