Added lock mechanism. Commente dout Mutex code as it crashes w qtbindings
code cleanup in read_packet method