fixes some bugs in the power logic