Make sure var is an int and remove unused var

Change-Id: I3fd8e42b00dad81d042ba38aed24ba6fd8bbe090