Moved function deserialization to prepare() to fix #230
Merge pull request #231 from ipostelnik/fix-230

Moved function deserialization to prepare() to fix #230