fixed bug in replace_mul_fpowxgpow; added comments and tests