Fixed division by 0 error that is raised sometimes.