Avoid crashing on irregular inputs.