Fixed null and division problems.