fix for settings.DEBUG being reset when test flag is used