check for errors when opening stream