Moved casting to GraphUtil