fixed a bug in validation