Fixed buffer position overflow and realloc size..