Fix warnings and error in AR4