Fixed error when adding functions to twig

Moved setLexer call to below registering filters and function
to prevent this error "Unable to add function as extensions have already been initialized."