This seems to be an improvement on the  bug I introduced with #143
though now my confidence is shot so I won't say it's fixed definitively.
I'm running short on time lately, so I'd like to come back around and
set up proper unit tests for these so we (I) don't regress in the
future. However, after living with this annoying bug for a few weeks,
I'd just rather get it back to working order.