Fixed/improved tests startup and exit