Prevent Infinite Loop

max_size may be unnecessary as a loop sentinel. related #1684