added lock unlock functions