continued to work on nonlinear correction, found a bug in memiterator, not totally sure if the change could cause problems in future, left old line in commented for now. fixed another bug in get_memdata