rearranged some script and add check and install
before loading the lib