restore check for layer->maxfeatures (#4730)