changed subprocess to Popen in order to support python < 2.7