fixing power for nonnegative integers

#8560