Fixed error where end date wasn't being properly used