add err test and simplify some test handlers