Fixed missing variable err