fix (probably) issue with memory port handlers realloc