Add more consistency checks for type id generation