improved trace formula evaluation, fixes #1.