fixed bug on main func
Fixed bug on main func