Ensure the destroying order of static variables

To fix issue #52