fixed indexing error, added attribute selection support
because
fixed indexing bug and added attribute selection support