Fix some of the casts and a request

The PR fixes some of the "as" casts that access the element even if it could be null.

This also brings me to my request: 

Please stop using the "as" operator, but use a simple cast. This ensures that we catch an invalid cast immediately and don't run into any `NullReferenceException`s when accessing the object.