some test and lib improvments