fix bug when comparing timestamps