change code to adjust for ios7