Financial flows, financial crises, and global imbalances