Fix issue when setting delivery mode from string, add more tests to
cover.