updated logic due to new attribute in Task