Set proper flags only when setting is correctly set.