Bug fix for the scaling issues in sqrt and log