Fixed several bugs in the receiver (#640)