fix bug in directed