Fixed minor bugs in validation