fix issue on query chaining