Fixed the .cmp() method, and implemented typechecking for ~