Made the server setup script more idempotent
Fixed some small issues in third installation script.