Fixed build and a bunch of warnings