remove code and add trace code when exception