Fixed getForeignCount()