Fixed the default key restoration functions.

They were completely broken since the start.

I also fixed the restore settings lua file.

This fixes issue #229.

Thanks to akien-mageia for pointing out.