Fixing SQL for ct_aliases table