Preserve layer ordering in layers.js