fix some validation bugs