set limits, update flags