update the inv saving and start to work on the logic (DOESN'T WORK WILL CRASH)

Signed-off-by: makidelille <makidelille@hotmail.fr>