Fix unsafe trim of settings