synchronize using lock