bugfix for wrap, still deeper problems to be investigated