Fixed bug in spectrum flip