added check on preg