move from check_output to Popen for older python versions