Fix table swap problem