do some refine

1.pep8
2.db decorator
3.bug fixes