added init and destroy with error