fixed bug with shared locks, with test