Re #1580 Reverted to latest correct code following incorrect merge