correct mistake in effect query
few minor fixes and tweak