Add unwrapIfNeeded and use it in a few places.
Merge pull request #144 from arv/unwrap-if-needed

Add unwrapIfNeeded and use it in a few places.