process different mode and some bug fix