make sure types are the same, and add some tests