Fix edit(...) so that functions themselves (not just the variable) are updated (fix #366)