merge with upstream, adapt mod