Fixed bug when filling spectrum