Fixed encoding and decoding of decimal fields, also included a workaround to decode the old values that were incorrectly encoded as doubles