fixed numerical errors