clean unused code
error handler