Smarty error reporting get environment value and more fixes