minor fixes
added 4 variables which reflect the number of valid object in the arrays