Avoid out of memory exception