add lock in proxy.c
lock version 2