Update Main.php

some fixes