findRoot optimization and bugfix

and minor std.math cleanup