Fixed bug in realloc. Finished.