- fixed a bug when using castToByte with an invalid long value