Smarty extensionfixes

This fixes issue #295, as well as some other minor issue.