Added check for invalid past date