Fixed bug in build community matrix