Bug fix: divisions by 0