Fix outputting wrong value