corrected mistake in unit tests + modify key checking in array