Bugfix: wait-fn should take attempt argument.