fix for "Bind must be called on a function" error

related issue: #289