Update lib.php

Updated the lib.php to cope with the new settings page. Also a minor
change in settings page