Fixes #1059 (closed). (Well, works around it in our codebase. I doubt upstream is going to improve soon.)