added type casting for Swift