fixes #2279 by catching IAE error