Make robust to bad data

Do not fail if n or last is missing.