GEOS-5826 backport to 2.3.x