Use Introspection to make code safe

The method firstObject of an Array returns an id (pointer to object) so
we could use introspection to be sure that we are using some kind of
object, in this way we avoid unwanted crashes