reverted back to old lib.php