fix pow aliasing issue and add test code