How this has slipped through a few pair of reviewing eyes ;-) Corrects changes added in #571 and #594