modify previous change to work with iOS