Use unsafe casts to indicate non-null values

This should reduce the amount of null checks.
Not sure whether this actually works because the graph shows them removed but performance is not really changed.

Signed-off-by: Stefan Marr <git@stefan-marr.de>