fix double unlock in pmidi