add some mods for optimization