Fixed initial ordering issue with layers.