Fixes to typechecking of DoLoop.