slightly improved module ownership logic