class casting for class or nil