trying to fix out of memory exception