LPS-50083 Changed assignment. This should fix the bug
LPS-50083 Refactored to avoid one new if with same condition