Fixed for beginning and end dates to work