fix bug in the snippet