Fix some bugs in installation process.