Small fixes for templates and routes.
Fixes for building templates.
Merge pull request #127 from xiaohutai/fixes-for-templating

Some fixes for templating