fixes segfaults caused by stubbing