Added changes from PR #373 in opm-core to opm-autodiff

These commits are just copies of Rolands commits in PR #373 in opm-core. Git probably has a way of appling them directly, but I don't know them.