added error handler on line 268