Revert r199791.

It's old version which has some bugs. I'll commit lattest patch soon.