fixed library calls, improved test cases