Fixed and improved iOS detection