Added receiver tests and fixed bugs in sender