rebase and adjust to changes from 957d375