Fixed invalid variable bug