// added lock to prevent running the task twice at the same time