fixed no attribute error, and template bugs