add check for NULL task