Fixed some memory lacks
Updated events managing (not tested)