Fix bug in JAVA-505 fix.