solve a bug in main.rb