move module check to lib