update installation script to be more robust