update gem, add timeout, use mutex