Okay, so that was the actual bug, the 'missing' line that's also in the calendar plugin.
I've been rewriting the calendar code to be more compact and a bit faster. I'll use that as well in here, but I need to know if you'd like to have your PR merged before I replace it (for the principle, although I don't like committing stuff I know won't be there for more than a few minutes because it slows down the git blame process), or if you don't mind that I reject your PR, commit my version instead and credit you for the actual fix?