clean up flags