fixed numerous compiler warnings and errors