ported maintain.php to lib2