switch tobytes back to tostring for old PIL compatibility