instead of using __destruct, used shutdown_register