commit before clearing the code