Some extra safeguards to prevent bad data.