Fixed not passing layer index