Fix lock order reversal