Removing trace and checking for 0 denominator