Added missing imports and fixed logical bug related to $filtAfterDate