Add tests for Types and fix sdb_type()