Added check on memory.