added error and handler