fixing bug on templates regexp