fix snippet closure bug