added error hook