Add check for bad table_id.
Changed some error messages to a more suited type.