modification of mypow2 to try and fix segfault