handle OutOfMemory error