keep box in bounds