check number of layers