Fix library and tests