Subtle error in calc_powerspec caused seg fault