My patch to solve the issue is a bit different though and I think it is slightly better readable. I'd be glad if you could test/review it.