Fixed a bug with validation