Fixed several bugs in install script