#55 fixed. The fix will only work for layers that have no duplicates in the database.