Fixes compile warnings, other minor fixes