fixing invalid inputs count bug