Also fix other instances of similar patterns.
Thanks to kunitoki for the report.
Fixes #2305 (closed)