port travis fixes from #2380 to master