Fix some bugs in installation scripts