Fix warnings and compile errors