Backport https://github.com/hazelcast/hazelcast/pull/3926/