fixed a major bug in generation of matrix elements with the new 'faster' function