used lock() for shared pointer