improve wrap support
Merge pull request #346 from wenshao/master

improve wrap support