fix swift bugs