added a unit test and fixed a wraping bug