fixed undefined typeerror issue for Iphone