Modification to avoid date error