Fix segfault on error in function evaluation
Add "def" builtin function