Wmts fix

Suggested fix for issue #2274