Fixed prototype of read_loop