Fix the recursive optimized power calculation