Fixed TX FIFO insertion bug and debug file handle bug