Fix Windows compiler error and one possible null pointer usage.