Revert "1310072002"

This reverts commit 2fae6146f330552fe9544caed781ef99dbb1578f.
Revert "Revert "1310041943""

This reverts commit fcb795b5fe4e8f0569002effa2fc4c3b404c0c82.
Revert "1310041943"

This reverts commit f6e1940878c3dea546e92fb944c0545d49a4b607.
1310072208
1310072212
1310072255
1310072320
1310072321
1310081942

fix some bug , when  rs.td == 0 or rs.td<0