forward-ported the changes made in 1.40.2.1