added error tracking