calculate number of plugins correctly