Fix and improve some block stats range checks and error messages.