remove unnecessary changes & fix index closing subquery