Added error checking in Mem