added next so that errors are handled properly