handle error in the auth check wrapper
even better error handling
handle br properly (I think)