fixed some validation bugs.