add maxObjectCount security check