don't advance iterator in a match(doc) method
fix potiential NPE