add crash record function