Fixes dotCMS/core-2.x#40 back port from 3.0 fix