fixed error with unreferenced variable