fixed a bug in wrap