Fix some bugs in tendency