fixed most compilation issues