add validator and error handler