Fixes for library tests

\cc @mishanga @dfilatov 

fix #251