fixing crash in date method