Fixed indexing bug in total power output code