using check_output instead of Popen.communicate()