Casting and null errors in older versions