Rewrited lib/lib_template