changed echo on error and file names in /tmp folder to avoid collisions