Fix bugs in a snippet