some bug fixes. not for product using, unstable commit.