Rebind functions during object cloning (cc#2045)

Based on pull #132. Fixes [CC#2045](http://issue.cc/r3/2045). Tested in Linux (0.4.4).