fix definition switching
refactor definition swapping