Fixed a bug and two warnings introduced recently.