added a check in case the matchingTaskEntity is null