clean up
handle iOS 7 and 8 specific issues. close #5221. close #544. ref #484.