Fix warnings

and the code compiles without warnings when using -Wall