Fixed min_len calculation