Fix for OutOfMemoryException on certain devices