fixed Nil to Date comparition error