update main.R and fix some errors