India, US 'agree' Pakistan must undo terror safe havens