[fixes] Fix a couple of EXC_BAD_ACCESS memory access bugs on OSX that cause real instability

These 2 bugs cause a significant amount of crashes on OSX especially when scanning movies and downloading images.