Fix more exceptions (similar to #11792).