when tony accidentally wishes he could meet a famous pirate jeannie sends him back in time to the ship and to make matters worse a woman being held captive on the ship is an ancestor of tony so he must save her or cease to exist