Added module descriptor and activation checks
Corrected 3 missing $error_occurred flags