updated to prevent settings loss