Bugfixes in unwrap