change subprocess call to Popen