Fix incorrect memset call + incorrect object deferencing