fix tests and do better validation