Improving db_type and get_internal_type