fix ref pop calculation bug