Fixes bug which resulted in making it so layers from all layers are getting updated. Reported by Juan Pablo Bouza.