fixed missing variable bug