Fixed bug with handling of circular graphs