fixed reopened issue 17 - aliasing fixes and treatement of subqueries altered