fixing compilation issues and warnings