Added test case for memory warning crash. Fixed decode logic