Rewrite popen check