Fix two phase name lookup errors detected by GCC but not VC++. Ditto some signed/unsigned compare warnings.