fix variable incorrectly declared as unsigned