Added a check to see if memory was available before create a byte array, although it doesn't seem to help much...