Pull request to fix #6237

@dirk-thomas please review.