lib: various fixes
0.5.4