add Lock when you get uid then write db