fix rule fails when type is a RegExp