Added stream:error handler and switched the ordering of functions in component authentication handler