fixed type error with regex