adding error handler to exists