Fix bugs and tune the installation procedure