remove unreachable code and update the recorder code