Fixed yet another bug in spectrum calculations