changed the stream listener to use subscription and also added the error handler