fix bugs and add Queue utils