Update lib.php

Update lib to match database table changes.