bug fix and add queue

fix the bugs and misspells. add the Queue class meanwhile.