Fix query for certificate date