catching out of memory error