handle transition end correctly
tidying