........S. [ZBX-8092] removed superfluous checks and fixed several bugs during code review