finally fixed snippet