Modified the power function to correctly handle zero inputs.