Expand Query string correctly