Fixed generate bug