Adding checks for null pointers (0x0) and increasing some variable buffers. This seems to completely take care of the invalid address errors.