I noticed this bug while testing my changes, so I attempted to fix it. Hopefully fixing it in this PR isn't a problem.