- fix what should be fixed

- do some refactor