fix slot calculation when writing for producer