Use a more reliable way to get next mode