fix major Template.class bugs and create Console.class