fixed snippet runtime error