Add bounds check for max_queue_size