gc: Fix erroneous lock manipulation