Minor fix to Main function