made parseDate method more robust