realloc seems to assume memory corruption if the new size is too large(?)

also, add another assert to track a document where it doesn't hold