cleanup code so it builds with gcc