lib: stricter checks
lib: misc changes