fixed 'temp' var, now casting to int