EZP-21735: fixed using non existent variable

This PR resolves issue https://jira.ez.no/browse/EZP-21735

This fixes usage of undefined variable.
Manually tested.