fixed a class cast exception on a specific graph. fixed issue #319
fixed an inmemory test