safeguard for numerical error
safeguard for numerical error