Fixed a bug where validation would break on null or undefined values.