modified init and exit