Add env validation and associated exception on modules* controller
Fix a bug in modules