fix ios compatibility issues with ios / fix some concurrency issues / enhance protocol