Make all tests go via main entry method

Fixes a few bugs