Fix issue #56: clean up environment before gbuild'ing

Originally proposed by cfields