some fix. and preparing for introduction of TAILQ
fixed queue handling bug. it still has extra-copying bug.