-BZ-1105868:adding checks for emptylists(backport)