Allow index 0 for dynamic queries

Previous code would just take the metric name instead of the first node. Explicitly checking whether index is defined make sure we really use the intended index when given.
Merge pull request #18 from mathias-baumann-sociomantic/patch-1

Allow index 0 for dynamic queries