added debug on query