Refrence library and fix errors