Fixed version of PR #2598