Fixed issue with writing nil dates