optimize
fix db bug