Added prevention infinite loop if wrong template

Fix for Issue [https://github.com/rogie/Dug.js/issues/7].