handle __key__ composite queries and fix transaction issue