Fixed compiler errors exposed by gcc