fixed memory leak, added array filter support