Fixed validation logic error