Bug fix in memomry dealocation on the native side