Make sure not to accept invalid data.