Added support for variables in indexing operators

fixes #657