now correctly handles edit after swap