two bug fixes, divide by zero and null values causing error, both fixed