Fix some bad memory accesses in settings.c