fixed memory checking in volume

if out of memory or other memory allocation problem, it will crash otherwise