fixed logging bug and made the jade template for detail more robust