Fixes for 6b7ce1fa48e998ff205ba0721b0290ee960bb379