swift goof, need to check for nil when casting with as