Better way of handling binary strings - should fix JRuby 1.9 issue.