fixed layer index issues