Fix for Column not found error

Fixes problem where optimizer loses track of columns in a nested subquery.