fixed memory consumption problem with shutdown handler