fix bug or at least improve "to_bytes" variable so that it works with non-integers...