fixed code snipped bug