Thanks for reporting this. I reproduce the problem, and installed the attached fix into the emacs-25 branch.