divide by zero fix
internal functions