Fixed memory corruption. AddressSanitizer: heap-buffer-overflow