Fix bug highlighted by fix to #1232