add some tests and rewrite tests