add error handler for jstream. clean up a bit.