Test libs

Improve libs so that all tests on them passes.

Currently, ./testfull.sh does test only a subset of files in lib/.
Once #994 is merged, this PR will allow the full test of them