add some tests and fix broken