corrected flag reset position