fixes #7, better error handling

Added exception handling (see #7) if a template compilation failed