Made install script more robust.