fix validation bugs