stubbing contacts calls and fixing global leaks