Fix trap release checks removing locks