fix repeat of test; remove unused variable by use of each_key