used popen instead of shell_exec