sys_var_insert_id returned LAST_INSERT_ID instead of INSERT_ID, as Guilhem suggested.
Attach a file by drag & drop or click to upload