Correctly populate getLastError command for legacy write operations