functional tests + fix $index binding