Fix memory bug that effects 32-bit systems