Fixed nest query behavior

remove whitespaces to match with /^SELECT/ pattern.