Fixed minor end condition bug.