Applying pteague's patch (re #685)