Fix requirejs and templates issue