fix coalesce problem, add realloc test case