add MAX_NAL and clean  MAX_ENTRIES