Cherrypicked @dschub's vein fix - thanks!