LPS-36654

Hi @rotty3000,

I included your changes (from https://github.com/topolik/liferay-portal/pull/46) and fixed the other problems I mentioned.

At the end are 3 commits that are not important for backport, just to have a clean code.

Thanks.