Stronger data validation.

Signed-off-by: ushi <ushi@porkbox.net>