Fix several bugs, install-check passed