Fix bytesAllocated sign-extension issue