.......PS. [ZBX-8188] moved condition closer to start of a function