Fixed bug in validation