Added exception for invalid modules