iOS: fix bugs caused by debugging code