Luis' original patch from JDEV-25473
Update Luis' original patch from JDEV-25473