Remove compiler warnings and also fix up a bug.