column name 'type' error, added fallback function for couple table