Fixes based on @le717 and @Mark-Simulacrum's feedback.