error_handler in session passed & write_queue_size added & some fixes