fix ref bug (#212)