Remove pointless double-lock and improve module branch coverage