Backport fixes to 1.8

backports for gh-2799, gh-3504, gh-4191, gh-4288

couldn't resist adding the fasttake improvement :/ it should be impossible that this causes issues but I can remove it if wished.