Ringgit at three-year low as foreign investors cut stakes