Cleanup and bugfixes of install script