typing and dirty flag fix