Correct function copy crash (cc#2043)

Based on pull #122. Fixes [CureCode issue 2043](http://issue.cc/r3/2043).Tested in Linux (0.4.4)