update module check logic

- adopt p0deje's suggestion