Made the install script more robust