catch overflow error in private algorithm