copy from lvkun.github.com, thanks.