bugfix - fixed a divide by zero case