fix UI bugs and add some DB and UI function