Did some minor fixup of data type checking.

It really should be rewritten more extensively.