fix cursor by key for memory implementation