fixed sql queries on alias table to avoid losing previously entered aliases