Reworked solution for corrupted settings.txt file