fix bugs and add benchmark