backported fix for Jdk bug 802937