Fix a couple bugs just discovered on gcc 4.7