rewrite ajax part
fix some bug