Fixed install script to handle error