Memory leak when defining functions (fix #359)