Fix for GitHub issue 2511