fixed two bugs, still many bugs remained.