added locks to avoid race conditions when touching the timers array