Added more message debug outputs and fixed a missing break bug