fixed typo, syntax error.
In order to display html page to users without delay caused by cron run execution, moved cron execution to system event 'finish' and added ob_flush to send all html codes to users browsers.