Fixed error when date was larger than the max date. Also fixed the error message when cursor was not set.