Fix debug mode not working and template plugin