Fix warnings and errors