bug fixing for inmemory