protected static function install_shutdown(){
    if (static::$inited_shutdown) return;
    
    // Disable time limit
    set_time_limit(0);
    
    // HHVM support
    if(function_exists('register_postsend_function')){
      register_postsend_function(function(){
        Event::trigger('core.shutdown');
      });
    } else if(function_exists('fastcgi_finish_request')) {
      register_shutdown_function(function(){
        fastcgi_finish_request();
        Event::trigger('core.shutdown');
      });       
    } else {
      register_shutdown_function(function(){
        Event::trigger('core.shutdown');
      });
    }

    static::$inited_shutdown = true;
  }