Thanks for the bug report and fix. I installed it into master, followed by the attached performance tweaks.