Fixed bug receiving packets and created tests