correction after refactor main.php