Fix dirty flag not popping