Out Of memory exception fix

Out Of memory exception fix