Various test fixes and rebase conflicts