Changed code to use new .as(...) when casting CFType derivatives