add some tests. fix update