change handleerror funciton to include correct funciton.