See this discussion for details.
I've written a unit test and a patch to fix this, pull request coming shortly.