updated logging on queries