fixed bug in packet parsing thanks to @besomba and modified debug log