fix typo in incomming data
add debug messages and improved parsing