Lib: Fix "type mismatch" warnings and errors.