same fix for bug 3587 as in 2.5.1 branch