Fixed instances method such that it accepts names

Previously, when invoked with `names` argument, the :instances method was raising an exception `can't convert Symbol to Integer`. This patch fixes the issue.