Bug fix related to return code handling in TaskWrapper.

Thanks to Peter Cock for finding this.