Fix swift casting bug.