Fixing REGISTRY-2251 - As  a result of CARBON-14867 fix

Resent this pull request.

Related carbon4-kernel pull request - https://github.com/wso2-dev/carbon4-kernel/pull/57