Bugfix for floating point exception caused by a divide by zero