fix sending binary and add tests