lib: further improvements