Add some new function to operate database
Fixed some mistakes.
Fixed some misatkes.