Fixed a few issues in ModulesManager.php