fix empty queue scenario.
Merge pull request #34 from gcheng/emptyQueue

fix empty queue scenario.
Merge pull request #329 from gcheng/dev

Dev