Added null reference checks to the `.As<T>` extensions