Fixed import bug and added stream on end emit file exported.