bug fixes related to calling native functions