Fixing the swapping crash/duplicating issues