..F....... [ZBXNEXT-1782] removed useless code; added test cases; fixed clearing of $afterSpace variable