Fixed set but unused variable bugs