function spy done