add tests, fixed validator bugs