a couple of tweaks to the script and fixes found when setting it up on a server