why not do an if (is_file()) instead?