fix reading and filtering in wide char version