cleanup code for clean compile with g++
more g++ improvements that also keeps gcc happy