fix base_table calculation using aliases table