Avoid holding the device lock when it isn't needed