Bugfix : wrong object was stored
Update of code based on feedback static code checkers