Fix issue that caused 1 email only to be sent instead of 2
various minor fixes and improvements related to tests and config