use an error monad in reader