fix warnings reg. set but unused variables

and remove/comment some other unused ones too