Fixing mobile JS bug