changing toByte to getBytes to fix json output

Fixes #197 - not sure if this ever worked before but this fixes it.