some syncronization and cleaning