fixed all the bugs in wk1_ex12.rb