fixed a couple bugs identified by gcc

Recent gcc is better.