added realloc functions