Bugfix generate-selections function so that it uses the argument
passed in rather than a variable in global scope.