Thanks for reporting the bug. Here is a fix. And we need tests as well.