a little fix to main function