Fixes WMS layer migration, adds tests.