fix bugs and improve detail.html