weighted average debugging