fixed some bug, test on GAE pass.