Remove null checks in casting, fixes #5