fixed python script echo properlly when run from php script, other minor tweaks