adds some error checking for mobile safari