fixed out-of-memory exception in some devices.