added error checking to memory option