added lock code