Improve the edge case about invalid module