Add 'make install' option and some bug fixes