fixed "Not an ARRAY reference" problem (mikolaj++)
cleanup